import java.util.Scanner;

public class GenerarPoligonos {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Poligonos fig[] = new Poligonos[4];
		
		fig[0] = new Rectangulos(); 

		fig[1] = new Triangulos();

		fig[2] = new Triangulos();

		fig[3] = new Rectangulos();

		double base, altura;
		
		Scanner entrada = new Scanner(System.in);
		for(int i=0; i<fig.length; i++) { 
			System.out.println();
			if(fig[i] instanceof Rectangulos){
				System.out.print("Base del Rectangulo: ");
			}
			else{
				System.out.print("Base del Triangulo: ");
			}
			base = entrada.nextDouble();
			
			fig[i].setAncho(base);
			
			System.out.println();
			if(fig[i] instanceof Rectangulos){
				System.out.print("Altura del Rectangulo: ");
			}
			else{
				System.out.print("Altura del Triangulo: ");
			}
			altura = entrada.nextDouble();
			
			fig[i].setAltura(altura);
			
			
		}
		System.out.println();
		for(int i=0; i<fig.length; i++){
			if(fig[i] instanceof Rectangulos){
				((Rectangulos)fig[i]).Perimetro(fig[i].getAncho(), fig[i].getAltura());
			}
			fig[i].Area(fig[i].getAncho(), fig[i].getAltura());
			
			System.out.println();
		}

	}

}
